﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:WickedFlame.VecDraw.Base.Controls">

    <Style TargetType="{x:Type Button}" x:Key="transparentButton">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Border BorderThickness="0" Background="Transparent">
                            <ContentPresenter VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                              HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
											SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:ColorSwitch}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <!--<Setter Property="Height" Value="30"/>
        <Setter Property="Width" Value="30"/>-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ColorSwitch}">
                    <Grid>
                        <Button Style="{StaticResource transparentButton}" x:Name="PART_SecondaryButton" Margin="15,15,0,0" ToolTip="Stroke color">
                            <Grid>
                                <Border BorderBrush="Black" BorderThickness="1" Background="White" CornerRadius="2">
                                    <Path Data="M10,0 L 0,10" Stroke="Red" StrokeThickness="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2"/>
                                </Border>
                                <Border BorderThickness="0" CornerRadius="2">
                                    <Border.Background>
                                        <SolidColorBrush Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedStrokeColor}"/>
                                    </Border.Background>
                                </Border>
                            </Grid>
                        </Button>


                        <Button Style="{StaticResource transparentButton}" x:Name="PART_PrimaryButton" Margin="0,0,15,15" ToolTip="Fill color">
                            <Grid>
                                <Border BorderBrush="Black" BorderThickness="1" Background="White" CornerRadius="2">
                                    <Path Data="M10,0 L 0,10" Stroke="Red" StrokeThickness="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2"/>
                                </Border>
                                <Border BorderThickness="0" CornerRadius="2">
                                    <Border.Background>
                                        <SolidColorBrush Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedFillColor}"/>
                                    </Border.Background>
                                </Border>
                            </Grid>
                        </Button>


                        <Border Name="Border2" BorderBrush="Black" BorderThickness="0" Background="Transparent" Margin="15,15,0,0" Visibility="Collapsed" ToolTip="Stroke color">
                            <Grid>
                                <Border BorderBrush="Black" BorderThickness="1" Background="White" CornerRadius="2">
                                    <Path Data="M10,0 L 0,10" Stroke="Red" StrokeThickness="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2"/>
                                </Border>
                                <Border BorderThickness="0" CornerRadius="2">
                                    <Border.Background>
                                        <SolidColorBrush Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedStrokeColor}"/>
                                    </Border.Background>
                                </Border>
                            </Grid>
                        </Border>
                    </Grid>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPrimarySelected" Value="false">
                            <Setter TargetName="PART_SecondaryButton" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="Border2" Property="Visibility" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>